package es.uem.sudoku;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;

public class Keypad extends Activity {
	
	protected static final String TAG = "Sudoku";	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.keypad);	
		
	}
	            
	public void onClickKeypad(View v) {
		int tile = 0;
		
		switch(v.getId())
		{
		case R.id.keypad_1:
			tile = 1;
			break;
		case R.id.keypad_2:
			tile = 2;
			break;
		case R.id.keypad_3:
			tile = 3;
			break;
		case R.id.keypad_4:
			tile = 4;
			break;
		case R.id.keypad_5:
			tile = 5;
			break;
		case R.id.keypad_6:
			tile = 6;
			break;
		case R.id.keypad_7:
			tile = 7;
			break;
		case R.id.keypad_8:
			tile = 8;
			break;
		case R.id.keypad_9:
			tile = 9;
			break;
		}
		
		returnResult(tile);		
				
	}

		



	private void returnResult(int tile) {
		Intent data = new Intent();		
	
		data.putExtra("tile", tile);
		data.setData(Uri.parse( "keypad tile"));		
		setResult(RESULT_OK, data);

		finish();
	}

}